<!DOCTYPE html>
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
  <meta name="description" content="Gan Xiao chuan&#39;s blog">
  <meta name="keyword" content="hexo-theme, vuejs, GXC, ganxiaochuan">
  
    <link rel="shortcut icon" href="/gxc_doc/css/images/logo.png">
  
  <title>
    
      立即使用 | GXC&#39;s blog
    
  </title>
  <link href="//cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
  <link href="//cdn.bootcss.com/nprogress/0.2.0/nprogress.min.css" rel="stylesheet">
  <link href="//cdn.bootcss.com/highlight.js/9.12.0/styles/tomorrow.min.css" rel="stylesheet">
  <link rel="stylesheet" href="/gxc_doc/css/style.css">
<link rel="stylesheet" href="/gxc_doc/css/plugins/gitment.css">
  <script src="//cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  <script src="//cdn.bootcss.com/geopattern/1.2.3/js/geopattern.min.js"></script>
  <script src="//cdn.bootcss.com/nprogress/0.2.0/nprogress.min.js"></script>
  <script src="/gxc_doc/js/qrious.js"></script>
<script src="/gxc_doc/js/gitment.js"></script>
</head>
<div class="wechat-share">
  <img src="/css/images/logo.png" />
</div>

  <body>
    <header class="header fixed-header">
  <div class="header-container">
    <a class="home-link" href="/gxc_doc/">
      <div class="logo"></div>
      <span>GXC's blog</span>
    </a>
    <ul class="right-list">
      
        <li class="list-item">
          
            <a href="/gxc_doc/" class="item-link">Home</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/gxc_doc/tags/" class="item-link">Tags</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/gxc_doc/archives/" class="item-link">Archives</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/gxc_doc/project/" class="item-link">Projects</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/gxc_doc/about/" class="item-link">About</a>
          
        </li>
      
    </ul>
    <div class="menu">
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
    </div>
    <div class="menu-mask">
      <ul class="menu-list">
        
          <li class="menu-item">
            
              <a href="/gxc_doc/" class="menu-link">Home</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/gxc_doc/tags/" class="menu-link">Tags</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/gxc_doc/archives/" class="menu-link">Archives</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/gxc_doc/project/" class="menu-link">Projects</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/gxc_doc/about/" class="menu-link">About</a>
            
          </li>
        
      </ul>
    </div>
  </div>
</header>

    <div id="article-banner">
  <h2>立即使用</h2>
  <p class="post-date">2017-11-23</p>
  <div class="arrow-down">
    <a href="javascript:;"></a>
  </div>
</div>
<main class="app-body flex-box">
  <!-- Article START -->
  <article class="post-article">
    <section class="markdown-content"><h1 id="立即使用"><a href="#立即使用" class="headerlink" title="立即使用"></a>立即使用</h1><p><strong>使用前提</strong>在使用GXC前，我们假设你已经有了一定的JavaScript 基础以及Vue基础(至少知道怎么使用最基础的Vue知识)，那么你已经符合使用GXC的条件了，让我们开始吧。</p>
<hr>
<h2 id="引用GXC"><a href="#引用GXC" class="headerlink" title="引用GXC"></a>引用GXC</h2><blockquote>
<p>我们已经将GXC打包好了，你需要在引用Vue后引用一个js文件以及两个css文件即可。    </p>
</blockquote>
<p>Vue文件 <code>&lt;script src=&quot;http://gxc.ganxiaochuan.top/vue.js&quot;&gt;&lt;/script&gt;</code><br>GXC主要js <code>&lt;script src=&quot;http://gxc.ganxiaochuan.top/gxc.js&quot;&gt;&lt;/script&gt;</code><br>GXC主要CSS <code>&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;http://gxc.ganxiaochuan.top/gxc.css&quot;&gt;</code><br>GXC的Icon    <code>&lt;link href=&quot;http://gxc.ganxiaochuan.top/font-awesome.min.css&quot;&gt;</code></p>
<h3 id="代码块"><a href="#代码块" class="headerlink" title="代码块"></a>代码块</h3><figure class="highlight htmlbars"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">&lt;script src="http://gxc.ganxiaochuan.top/vue.js"&gt;&lt;/script&gt;</span><br><span class="line">&lt;script src="http://gxc.ganxiaochuan.top/gxc.js"&gt;&lt;/script&gt;</span><br><span class="line">&lt;link rel="stylesheet" type="text/css" href="http://gxc.ganxiaochuan.top/gxc.css"&gt;</span><br><span class="line">&lt;link href="http://gxc.ganxiaochuan.top/font-awesome.min.css"&gt;</span><br></pre></td></tr></table></figure>
<h2 id="实例化Vue"><a href="#实例化Vue" class="headerlink" title="实例化Vue"></a>实例化Vue</h2><h3 id="代码块-1"><a href="#代码块-1" class="headerlink" title="代码块"></a>代码块</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">&lt;div class=&quot;temp&quot;&gt;</span><br><span class="line">    &lt;gbutton size=&quot;lager&quot;&gt;&lt;/gbutton&gt;</span><br><span class="line">&lt;/div&gt;</span><br><span class="line">&lt;script&gt;</span><br><span class="line">    Vue.use(gxc);</span><br><span class="line">    var page=new Vue(&#123;</span><br><span class="line">        el:&apos;.temp&apos;</span><br><span class="line">    &#125;)</span><br><span class="line">&lt;/script&gt;</span><br></pre></td></tr></table></figure>
<p>如果你可以看到如下效果</p>
<script src="http://gxc.ganxiaochuan.top/vue.js"></script>
<script src="http://gxc.ganxiaochuan.top/gxc.js"></script>
<link rel="stylesheet" type="text/css" href="http://gxc.ganxiaochuan.top/gxc.css">
<link href="http://gxc.ganxiaochuan.top/font-awesome.min.css">

<div class="temp">
    <gbutton size="lager"></gbutton>
</div>
<script>
    Vue.use(gxc);
    var page=new Vue({
        el:'.temp'
    })
</script>


<p>那么恭喜你成功了，我们开始使用吧</p>
</section>
    <!-- Tags START -->
    
      <div class="tags">
        <span>Tags:</span>
        
  <a href="/gxc_doc/gxc_doc/tags#简介" >
    <span class="tag-code">简介</span>
  </a>

      </div>
    
    <!-- Tags END -->
    <!-- 打赏 START -->
    
      <div class="money-like">
        <div class="reward-btn">
          赏
          <span class="money-code">
            <span class="alipay-code">
              <div class="code-image"></div>
              <b>使用支付宝打赏</b>
            </span>
            <span class="wechat-code">
              <div class="code-image"></div>
              <b>使用微信打赏</b>
            </span>
          </span>
        </div>
        <p class="notice">若你觉得我的文章对你有帮助，欢迎点击上方按钮对我打赏</p>
      </div>
    
    <!-- 打赏 END -->
    <!-- 二维码 START -->
    <div class="qrcode">
      <canvas id="share-qrcode"></canvas>
      <p class="notice">扫描二维码，分享此文章</p>
    </div>
    <!-- 二维码 END -->
    
      <!-- Gitment START -->
      <div id="comments"></div>
      <!-- Gitment END -->
    
  </article>
  <!-- Article END -->
  <!-- Catalog START -->
  
    <aside class="catalog-container">
  <div class="toc-main">
    <strong class="toc-title">Catalog</strong>
    
      <ol class="toc-nav"><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#立即使用"><span class="toc-nav-text">立即使用</span></a><ol class="toc-nav-child"><li class="toc-nav-item toc-nav-level-2"><a class="toc-nav-link" href="#引用GXC"><span class="toc-nav-text">引用GXC</span></a><ol class="toc-nav-child"><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#代码块"><span class="toc-nav-text">代码块</span></a></li></ol></li><li class="toc-nav-item toc-nav-level-2"><a class="toc-nav-link" href="#实例化Vue"><span class="toc-nav-text">实例化Vue</span></a><ol class="toc-nav-child"><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#代码块-1"><span class="toc-nav-text">代码块</span></a></li></ol></li></ol></li></ol>
    
  </div>
</aside>
  
  <!-- Catalog END -->
</main>

<script>
  (function () {
    var url = 'http://ganxiaochuan.gitee.io/gxc_doc/2017/11/23/UseNow/';
    var banner = ''
    if (banner !== '' && banner !== 'undefined' && banner !== 'null') {
      $('#article-banner').css({
        'background-image': 'url(' + banner + ')'
      })
    } else {
      $('#article-banner').geopattern(url)
    }
    $('.header').removeClass('fixed-header')

     // error image
    $(".markdown-content img").on('error', function() {
      $(this).attr('src', 'http://file.muyutech.com/error-img.png')
      $(this).css({
        'cursor': 'default'
      })
    })

    // zoom image
    $(".markdown-content img").on('click', function() {
      var src = $(this).attr('src')
      if (src !== 'http://file.muyutech.com/error-img.png') {
        var imageW = $(this).width()
        var imageH = $(this).height()
        
        var zoom = ($(window).width() * 0.95 / imageW).toFixed(2)
        zoom = zoom < 1 ? 1 : zoom
        zoom = zoom > 2 ? 2 : zoom
        var transY = (($(window).height() - imageH) / 2).toFixed(2)

        $('body').append('<div class="image-view-wrap"><div class="image-view-inner"><img src="'+ src +'" /></div></div>')
        $('.image-view-wrap').addClass('wrap-active')
        $('.image-view-wrap img').css({
          'width': `${imageW}`,
          'transform': `translate3d(0, ${transY}px, 0) scale3d(${zoom}, ${zoom}, 1)`
        })
        $('html').css('overflow', 'hidden')

        $('.image-view-wrap').on('click', function() {
          $(this).remove()
          $('html').attr('style', '')
        })
      }
    })

    // qrcode
    var qr = new QRious({
      element: document.getElementById('share-qrcode'),
      value: document.location.href
    });

    // gitment
    var gitmentConfig = "daivdkpfe";
    if (gitmentConfig !== 'undefined') {
      var gitment = new Gitment({
        id: "立即使用",
        owner: "daivdkpfe",
        repo: "Blog",
        oauth: {
          client_id: "b5368d7764454f9061c5",
          client_secret: "1d1f22b07174e1c90623fc4ad23b341969f09346"
        },
        theme: {
          render(state, instance) {
            const container = document.createElement('div')
            container.lang = "en-US"
            container.className = 'gitment-container gitment-root-container'
            container.appendChild(instance.renderHeader(state, instance))
            container.appendChild(instance.renderEditor(state, instance))
            container.appendChild(instance.renderComments(state, instance))
            container.appendChild(instance.renderFooter(state, instance))
            return container;
          }
        }
      })
      gitment.render(document.getElementById('comments'))
    }
  })();
</script>

    <div class="scroll-top">
  <span class="arrow-icon"></span>
</div>
    <footer class="app-footer">
  <p class="copyright">
    &copy; 2017 | Proudly powered by <a href="https://hexo.io" target="_blank">Hexo</a>
    <br>
    Theme by <a href="https://github.com/yanm1ng">yanm1ng</a>
  </p>
</footer>

<script>
  function async(u, c) {
    var d = document, t = 'script',
      o = d.createElement(t),
      s = d.getElementsByTagName(t)[0];
    o.src = u;
    if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
    s.parentNode.insertBefore(o, s);
  }
</script>
<script>
  async("//cdn.bootcss.com/fastclick/1.0.6/fastclick.min.js", function(){
    FastClick.attach(document.body);
  })
</script>

<script>
  var hasLine = 'true';
  async("//cdn.bootcss.com/highlight.js/9.12.0/highlight.min.js", function(){
    $('figure pre').each(function(i, block) {
      var figure = $(this).parents('figure');
      if (hasLine === 'false') {
        figure.find('.gutter').hide();
      }
      var lang = figure.attr('class').split(' ')[1] || 'code';
      var codeHtml = $(this).html();
      var codeTag = document.createElement('code');
      codeTag.className = lang;
      codeTag.innerHTML = codeHtml;
      $(this).attr('class', '').empty().html(codeTag);
      figure.attr('data-lang', lang.toUpperCase());
      hljs.highlightBlock(block);
    });
  })
</script>
<!-- Baidu Tongji -->

<script src="/gxc_doc/js/script.js"></script>
  </body>
</html>